package com.hogae.capital.service.impl;

import java.util.List;

import com.hogae.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hogae.capital.mapper.CapPoolAccountMapper;
import com.hogae.capital.domain.CapPoolAccount;
import com.hogae.capital.service.ICapPoolAccountService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 资金池账户Service业务层处理
 *
 * @author hogae
 * @date 2021-02-26
 */
@Service
@Transactional(rollbackFor=Exception.class)
public class CapPoolAccountServiceImpl implements ICapPoolAccountService {
    @Autowired
    private CapPoolAccountMapper capPoolAccountMapper;

    /**
     * 查询资金池账户
     *
     * @param id 资金池账户ID
     * @return 资金池账户
     */
    @Override
    public CapPoolAccount selectCapPoolAccountById(Long id) {
        return capPoolAccountMapper.selectCapPoolAccountById(id);
    }

    /**
     * 查询资金池账户列表
     *
     * @param capPoolAccount 资金池账户
     * @return 资金池账户
     */
    @Override
    public List<CapPoolAccount> selectCapPoolAccountList(CapPoolAccount capPoolAccount) {
        return capPoolAccountMapper.selectCapPoolAccountList(capPoolAccount);
    }

    /**
     * 新增资金池账户
     *
     * @param capPoolAccount 资金池账户
     * @return 结果
     */
    @Override
    public int insertCapPoolAccount(CapPoolAccount capPoolAccount) {
        capPoolAccount.setCreateTime(DateUtils.getNowDate());
        return capPoolAccountMapper.insertCapPoolAccount(capPoolAccount);
    }

    /**
     * 修改资金池账户
     *
     * @param capPoolAccount 资金池账户
     * @return 结果
     */
    @Override
    public int updateCapPoolAccount(CapPoolAccount capPoolAccount) {
        capPoolAccount.setUpdateTime(DateUtils.getNowDate());
        return capPoolAccountMapper.updateCapPoolAccount(capPoolAccount);
    }

    /**
     * 批量删除资金池账户
     *
     * @param ids 需要删除的资金池账户ID
     * @return 结果
     */
    @Override
    public int deleteCapPoolAccountByIds(Long[] ids) {
        return capPoolAccountMapper.deleteCapPoolAccountByIds(ids);
    }

    /**
     * 删除资金池账户信息
     *
     * @param id 资金池账户ID
     * @return 结果
     */
    @Override
    public int deleteCapPoolAccountById(Long id) {
        return capPoolAccountMapper.deleteCapPoolAccountById(id);
    }

    /**
     *
     * @param capPoolAccount 资金池账户禁用状态
     * @return
     */
    @Override
    public int updateCapPoolAccountStatus(CapPoolAccount capPoolAccount) {
        return capPoolAccountMapper.updateCapPoolAccountStatus(capPoolAccount);
    }

    @Override
    public List selectByUserId(List userIdList) {


        return capPoolAccountMapper.selectByUserId(userIdList);
    }
}
